<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/11/19
  Time: 17:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="navigation-area" id="fixheader">
    <div class="container">
        <div class="row">
            <!-- Categories List Start -->
            <div class="col-10 col-lg-3">
                <div class="categories-list-wrap">
                    <div class="btn btn-category d-none d-lg-inline-block"><i class="fa fa-bars"></i> 分类
                    </div>
                    <ul class="category-list-menu" id="cate">

                    </ul>
                </div>
            </div>
            <!-- Categories List End -->

            <!-- Main Menu Start -->
            <div class="col-2 col-lg-9 d-none d-lg-block">
                <div class="main-menu-wrap">
                    <nav class="mainmenu">
                        <ul class="main-navbar clearfix">
                            <li class="dropdown-show"><a href="${pageContext.request.contextPath}/index.do">主页</a>

                            </li>
                            <li><a href="${pageContext.request.contextPath}/gotoAboutUs.do">关于我们</a></li>
                            <li class=""><a href="${pageContext.request.contextPath}/product/list.do">商品列表</a>

                            </li>

                            <li></li>
                            <li></li>
                            <li></li>

                            <li><a href="${pageContext.request.contextPath}/gotoContactUs.do">Contact Us</a></li>
                            <%--<li><a href="${pageContext.request.contextPath}/live/room/1000000000000001.do">淘直播</a></li>--%>
                            <li style="float: right;: right"><a href="${pageContext.request.contextPath}/car/showcar.do"
                                                                id="fly-end" class="btn-minicart">购物车</a></li>
                        </ul>
                    </nav>
                </div>
            </div>
            <!-- Main Menu End -->
        </div>
    </div>
</div>
</body>

<script src="${pageContext.request.contextPath}/static/js/vendor/jquery-3.3.1.min.js"></script>
<script>
$(document).ready(function () {
    $.ajax({
        url: '${pageContext.request.contextPath}/getCategory.do',
        type: "post",
        success: function (data) {
            var result = "";
            for (var i = 0; i < data.length; i++) {
                result += "<li class='category-item-parent'><a href='${pageContext.request.contextPath}/product/list.do?cid=" + data[i].cid
                    + "' class='category-item'><span>" + data[i].cname + "</span></a></li>"
            }
            result += " <li class=\"category-item-parent\">\n" +
                "<a href=\"#\" class=\"category-item btn-more\">More Categories</a>\n" +
                "</li>";

            $("#cate").append(result);
        }
    })
})


</script>
</html>
